package cn.edu.sdust.service.impl;

import cn.edu.sdust.dao.StudentDao;
import cn.edu.sdust.pojo.Student;
import cn.edu.sdust.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    //调用dao层的操作，设置一个set接口，方便Spring管理
    @Autowired
    private StudentDao dao;

    @Override
    public boolean addStudent(Student student) {
        return dao.addStudent(student)>0;
    }


    public int deleteStudentById(Integer[] ids) {
        return dao.deleteStudentById(ids);
    }

    //按id查询某一个学生
    @Override
    public Student queryStudentById(int id) {
        return dao.queryStudentById(id);
    }
    //查询所有学生
    @Override
    public List<Student> QueryALLStudents(Student stu) {
        return dao.queryAllStudent(stu);
    }

    @Override
    public boolean update(Student student) {
        return dao.updateStudent(student) >0;
    }

}